import request from '@/utils/request'

// 查询商品管理列表
export function listShangpins(query) {
  return request({
    url: '/shangpins/shangpins/list',
    method: 'get',
    params: query
  })
}

// 查询商品管理详细
export function getShangpins(goodsId) {
  return request({
    url: '/shangpins/shangpins/' + goodsId,
    method: 'get'
  })
}

// 新增商品管理
export function addShangpins(data) {
  return request({
    url: '/shangpins/shangpins',
    method: 'post',
    data: data
  })
}

// 修改商品管理
export function updateShangpins(data) {
  return request({
    url: '/shangpins/shangpins',
    method: 'put',
    data: data
  })
}

// 删除商品管理
export function delShangpins(goodsId) {
  return request({
    url: '/shangpins/shangpins/' + goodsId,
    method: 'delete'
  })
}

// 导入商品
export function importGoods(data) {
  return request({
    url: '/shangpins/shangpins/importData',
    method: 'post',
    data: data
  })
}

// 下载导入模板
export function importTemplate() {
  return request({
    url: '/shangpins/shangpins/importTemplate',
    method: 'post',
    responseType: 'blob'
  })
}